<template>
<H1>EL-表单组件</H1>
  <el-form label-width="80" style="width: 500px; margin: 0 auto">
    <el-form-item label="用户名" >
      <el-input placeholder="请输入用户名" v-model=" user.name"></el-input>
    </el-form-item>
    <el-form-item label="密码" >
      <el-input placeholder="请输入密码"show-password v-model="user.password" ></el-input>
    </el-form-item>
    <el-form-item label="性别" >
      <el-radio-group v-model="user.gender">
        <el-radio-button label="男" value="1"></el-radio-button>
        <el-radio-button label="女" value="0"></el-radio-button>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="城市">
      <el-select placeholder="选择你的所在地" v-model="user.city">
        <el-option label="重庆" value="cq"></el-option>
        <el-option label="石家庄" value="sjz"></el-option>
        <el-option label="武汉" value="wh"></el-option>
        <el-option label="" value="bj">北京</el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="管理员">
      <el-switch v-model="user.isAdmin"></el-switch>
    </el-form-item>
    <el-form-item>
      <el-button type="success" @click="show()">注册</el-button>
    </el-form-item>
  </el-form>

</template>
<script setup>
import {ref} from "vue";
// const name=ref('')
// const password=ref('')
// const gender=ref('')
// const city=ref('')
// const isAdmin=ref('')
const user=ref({
  name:'',
  password:'',
  gender:'',
  city:'',
  isAdmin:false
})
const show=()=>{
  console.log(user.value)
}
</script>


<style scoped>

</style>